#!/usr/bin/python3
# -*- coding: UTF-8 -*-
"""
命令行参数:
    通用实用程序脚本通常需要处理命令行参数。这些参数作为列表存储在 sys 模块的 argv 属性中。
"""
import sys
# 打印命令行参数
print(sys.argv)

import argparse
from getpass import getuser
parser = argparse.ArgumentParser(description='An argparse example.')
parser.add_argument('name', nargs='?', default=getuser(), help='The name of someone to greet.')
parser.add_argument('--verbose', '-v', action='count')
args = parser.parse_args()
# greeting = ["Hi", "Hello", "Greetings! its very nice to meet you"][args.verbose % 3]
# print(f' {greeting}, {args.name}')
if not args.verbose:
    print('Try running this again with multiple "-v" flags!')


